<?php


namespace api\web\model;
use think\Model;

class SpuModel extends Model
{
    protected $name='spk';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = false;

    public function getImageAttr($value)
    {
        return cmf_get_image_url($value);
    }

    public function getImagesAttr($images)
    {
        $imageArr = explode(',',$images);
        if (count($imageArr) > 0){
            foreach ($imageArr as $key => $image){
                $imageArr[$key] = cmf_get_image_url($image);
            }
            return $imageArr;
        }
        return [];
    }
}